<template>
  <div class="select-body-type">
    <div class="type-title">
      <div>{{activeId === 1 ? '当前目录':'当前相册' }} ：</div>
      <div @click="handleShowTypeSelect">
        {{activeId === 1 ? '最近项目':'个人相册' }}
        <span :class="[showDilog ? 'active-status' : '']">
          <i class="iconfont makersanjiaoxing"></i>
        </span>
      </div>
    </div>
    <div v-if="activeId === 1 && showDilog" class="type-box">
      <div class="select-type-local">
        <img src alt />
        <div>
          <span>最近项目</span>
          <span>（3476）</span>
        </div>
      </div>
      <div class="select-type-local">
        <img src alt />
        <div>
          <span>最近项目</span>
          <span>（3476）</span>
        </div>
      </div>
    </div>
    <div v-if="activeId === 2 && showDilog" class="type-box">
      <div class="select-type-cloud">
        <span>个人相册</span>
      </div>
      <div class="select-type-cloud">
        <span>个人相册</span>
      </div>
      <div class="select-type-cloud">
        <span>个人相册</span>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'SelectBodyType',
  props: {
    activeId: Number,
  },
  data() {
    return {
      showDilog: false,
    };
  },
  methods: {
    handleShowTypeSelect() {
      this.showDilog = !this.showDilog;
    },
  },
  watch: {
    activeId() {
      this.showDilog = false;
    },
  },
};
</script>

<style scoped lang="scss">
.select-body-type {
  width: 100vw;
  height: 8vh;
  position: relative;
  .type-title {
    width: 40vw;
    height: 100%;
    margin-left: 30vw;
    display: flex;
    justify-content: space-around;
    align-items: center;
    text-align: center;
    & > div:first-child {
      font-size: 12px;
      color: #919191;
    }
    & > div:last-child {
      font-size: 15px;
      color: #1e1e1e;
      position: relative;
      padding-right: 16px;
      span {
        position: absolute;
        top: 0;
        right: -6px;
        display: inline-block;
        width: 20px;
        height: 20px;
        text-align: center;
        line-height: 20px;
        transform: rotate(0deg);
        transition: all 0.3s;
      }
      i {
        position: relative;
        font-size: 12px;
      }
      .active-status {
        transform: rotate(180deg) !important;
      }
    }
  }
  .type-box {
    width: 94vw;
    max-height: 70vh;
    background-color: #ffffff;
    position: absolute;
    z-index: 100;
    top: 6vh;
    left: 3vw;
    border-radius: 10px;
    padding: 21px 0;
    overflow: auto;
    .select-type-local {
      // width: 100%;
      height: 20vw;
      display: flex;
      justify-content: flex-start;
      align-items: center;
      padding: 0 3vw;
      img {
        width: 16vw;
        height: 16vw;
        border-radius: 6px;
        overflow: hidden;
        background-color: pink;
      }
      & > div {
        padding-left: 15px;
      }
      & > div > span:first-child {
        font-size: 16px;
        color: #181818;
        font-weight: bolder;
      }
      & > div > span:last-child {
        margin-left: 6px;
        font-size: 14px;
        color: #bebebe;
      }
    }
    .select-type-cloud {
      width: 60vw;
      height: 10vh;
      margin: 5px auto;
      display: flex;
      justify-content: center;
      align-items: center;
      span {
        display: inline-block;
        width: 60vw;
        height: 7vh;
        text-align: center;
        line-height: 7vh;
        border-radius: 3.5vh;
        background-color: #f5f5f5;
        color: #989898;
        font-size: 16px;
      }
    }
  }
}
</style>
